package demoMod.stsconsole.commands;

import demoMod.stsconsole.enums.ErrType;
import demoMod.stsconsole.utils.ModLoader;

import java.util.Scanner;

public class Mod extends AbstractCommand {
    public static boolean allowLoadMods = true;

    @Override
    public void execute(String[] args, Scanner sc) {
        if (args.length > 1) {
            this.errMsg(ErrType.WRONG_ARGUMENT);
            return;
        }
        if (!allowLoadMods) {
            this.errMsg(ErrType.COMMAND_NOT_AVAILABLE);
            return;
        }
        if (args.length == 0) {
            new ModLoader("mods").loadMods();
        } else {
            new ModLoader(args[0]).loadMods();
        }
    }

    @Override
    public boolean requiredPrompt(String currentPrompt) {
        return "".equals(currentPrompt);
    }
}
